package WinterVacation.Day7;

import java.util.Random;

public class Num1 {
    public boolean findNumberIn2DArray(int[][] matrix, int target) {
        if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
            return false;
        }
        int n = 0;//行
        int m = matrix[0].length - 1;//列
        while(n < matrix.length && m >= 0){
            if(matrix[n][m] == target){
                return true;
            }else if(matrix[n][m] > target){
                m--;
            }else{
                n++;
            }
        }
        return false;
    }
}
